//
//  YTKRequestInterceptor.m
//  YTKNetworkExtension
//
//  Created by Jarvis on 2024/5/28.
//

#import "YTKRequestInterceptor.h"

@interface YTKRequestInterceptor ()
@property (nonatomic, copy) void(^willStart)(id);
@property (nonatomic, copy) void(^willStop)(id);
@property (nonatomic, copy) void(^didStop)(id);
@end
@implementation YTKRequestInterceptor

+ (instancetype)interceptorWillStart:(void(^)(id request))willStart willStop:(void(^)(id request))willStop didStop:(void(^)(id request))didStop {
    YTKRequestInterceptor *interceptor = [YTKRequestInterceptor new];
    interceptor.willStart = willStart;
    interceptor.willStop = willStop;
    interceptor.didStop = didStop;
    return interceptor;
}

- (void)requestWillStart:(id)request {
    !_willStart ?: _willStart(request);
}
- (void)requestWillStop:(id)request {
    !_willStop ?: _willStop(request);
}
- (void)requestDidStop:(id)request {
    !_didStop ?: _didStop(request);
}

@end
